package n.d.l.svn.bean;

import java.util.ArrayList;
import java.util.List;

public class Patch {

	private List<String> copyList = new ArrayList<String>();
	private List<String> removeList = new ArrayList<String>();
	private String relativeUrl;
	
	public void addRecord(String record){
		record = record.trim();
		String[] rs = record.split(" ");
		rs[1] = rs[1].replace("src", "WEB-INF/classes");
		rs[1] = rs[1].replace("WebRoot/", "").replace(".java", ".class");
		int index = rs[1].indexOf("WEB-INF");
		if(index > 0){
			rs[1] = rs[1].substring(index);
		}else{
			rs[1] = rs[1].replace(relativeUrl, "");
		}
		
		if(rs[0].equals("D")){
			removeList.add(rs[1]);
			copyList.remove(rs[1]);
		}else{
			//A,M
			copyList.add(rs[1]);
			removeList.remove(rs[1]);
		}
	}

	public List<String> getCopyList() {
		return copyList;
	}

	public void setCopyList(List<String> copyList) {
		this.copyList = copyList;
	}

	public List<String> getRemoveList() {
		return removeList;
	}

	public void setRemoveList(List<String> removeList) {
		this.removeList = removeList;
	}

	public String getRelativeUrl() {
		return relativeUrl;
	}

	public void setRelativeUrl(String relativeUrl) {
		this.relativeUrl = relativeUrl;
	}
	
}
